using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel;
using System.Drawing;

namespace TidhiGanitam
{
    public class DisplayProperties
    {
        object m_SelectedObject = null;
        public delegate void SelectedObjectChangedEventHandler(object sender, EventArgs e);
        public event SelectedObjectChangedEventHandler SelectedObjectChanged;

        private void OnSelectedObjectChanged()
        {
            if (SelectedObjectChanged != null)
            {
                SelectedObjectChanged(this, new EventArgs());
            }
        }

        [Browsable(false)]
        public object SelectedObject
        {
            get
            {
                return m_SelectedObject;
            }
            set
            {
                if (value is DataGridView)
                {
                    m_SelectedObject = value;
                }
                else {
                    m_SelectedObject = null;
                }
                OnSelectedObjectChanged();
            }
        }


        [Description("Set the header cell display style")]
        [Browsable(true)]
        [Category("Header")]
        public DataGridViewCellStyle HeaderDisplayStyle
        {
            get
            {
                if (m_SelectedObject != null)
                {return ((DataGridView)m_SelectedObject).ColumnHeadersDefaultCellStyle;}
                else{
                    return null;}
            }
            set
            {
                if (m_SelectedObject != null)
                {((DataGridView)m_SelectedObject).ColumnHeadersDefaultCellStyle.ApplyStyle(value);
                }
             }
        }
        [Description("Set the table display style")]
        [Browsable(true)]
        [Category("Table")]
        public DataGridViewCellStyle TableDisplayStyle
        {
            get
            {
                if (m_SelectedObject != null)
                { return ((DataGridView)m_SelectedObject).DefaultCellStyle; }
                else
                {
                    return null;
                }
            }
            set
            {
                if (m_SelectedObject != null)
                {
                    ((DataGridView)m_SelectedObject).DefaultCellStyle.ApplyStyle(value);}
            }
        }
        [Description("Set the display style for alternating rows")]
        [Browsable(true)]
        [Category("Rows")]
        public DataGridViewCellStyle AlternatingRowsStyle
        {
            get
            {
                if (m_SelectedObject != null)
                { return ((DataGridView)m_SelectedObject).AlternatingRowsDefaultCellStyle; }
                else
                {
                    return null;
                }
            }
            set
            {
                if (m_SelectedObject != null)
                {
                    ((DataGridView)m_SelectedObject).AlternatingRowsDefaultCellStyle.ApplyStyle(value);
                }
            }
        }
        [Description("Set the table border display style")]
        [Browsable(true)]
        [Category("Table")]
        public BorderStyle BorderStyle
        {
            get
            {
                if (m_SelectedObject != null)
                { return ((DataGridView)m_SelectedObject).BorderStyle; }
                else
                {
                    return BorderStyle.None;
                }
            }
            set
            {
                if (m_SelectedObject != null)
                {
                    ((DataGridView)m_SelectedObject).BorderStyle = value;
                }
            }
        }
        [Description("Set the table cell border display style")]
        [Browsable(true)]
        [Category("Rows")]
        public DataGridViewCellBorderStyle CellBorderStyle
        {
            get
            {
                if (m_SelectedObject != null)
                { return ((DataGridView)m_SelectedObject).CellBorderStyle; }
                else
                {
                    return DataGridViewCellBorderStyle.None;
                }
            }
            set
            {
                if (m_SelectedObject != null)
                {
                    ((DataGridView)m_SelectedObject).CellBorderStyle =value;
                }
            }
        }
        [Description("Set the table header border display style")]
        [Browsable(true)]
        [Category("Header")]
        public DataGridViewHeaderBorderStyle ColumnHeadersBorderStyle
        {
            get
            {
                if (m_SelectedObject != null)
                { return ((DataGridView)m_SelectedObject).ColumnHeadersBorderStyle; }
                else
                {
                    return DataGridViewHeaderBorderStyle.None;
                }
            }
            set
            {
                if (m_SelectedObject != null)
                {
                    ((DataGridView)m_SelectedObject).ColumnHeadersBorderStyle = value;
                }
            }
        }
        [Description("Set the table header height")]
        [Browsable(true)]
        [Category("Header")]
        public int ColumnHeadersHeight
        {
            get
            {
                if (m_SelectedObject != null)
                { return ((DataGridView)m_SelectedObject).ColumnHeadersHeight; }
                else
                {
                    return 0;
                }
            }
            set
            {
                if (m_SelectedObject != null)
                {
                    ((DataGridView)m_SelectedObject).ColumnHeadersHeight = value;
                }
            }
        }
        [Description("Set the table header height")]
        [Browsable(true)]
        [Category("Table")]
        public Font Font
        {
            get
            {
                if (m_SelectedObject != null)
                { return ((DataGridView)m_SelectedObject).Font; }
                else
                {
                    return null;
                }
            }
            set
            {
                if (m_SelectedObject != null)
                {
                    ((DataGridView)m_SelectedObject).Font = value;
                }
            }
        }
        [Description("Set the table text color")]
        [Browsable(true)]
        public Color TextColor
        {
            get
            {
                if (m_SelectedObject != null)
                { return ((DataGridView)m_SelectedObject).ForeColor; }
                else
                {
                    return Color.Black;
                }
            }
            set
            {
                if (m_SelectedObject != null)
                {
                    ((DataGridView)m_SelectedObject).ForeColor = value;
                }
            }
        }
        [Description("Set the table grid color")]
        [Browsable(true)]
        [Category("Table")]
        public Color GridColor
        {
            get
            {
                if (m_SelectedObject != null)
                { return ((DataGridView)m_SelectedObject).GridColor; }
                else
                {
                    return Color.Empty;
                }
            }
            set
            {
                if (m_SelectedObject != null)
                {
                    ((DataGridView)m_SelectedObject).GridColor = value;
                }
            }
        }
       
    }
}
